//
//  YYCForceUpdateVC.m
//  YourNextCar
//
//  Created by LLT on 2016/11/18.
//  Copyright © 2016年 LLT. All rights reserved.
//

#import "YYCForceUpdateVC.h"

@interface YYCForceUpdateVC ()

@property (weak, nonatomic) IBOutlet UILabel *titleLabel;
@property (weak, nonatomic) IBOutlet UILabel *msgLabel;
@property (weak, nonatomic) IBOutlet UIButton *titleBtn;
@property (weak, nonatomic) IBOutlet UIView *linView;

@property (nonatomic,strong) handel handel;

@end

@implementation YYCForceUpdateVC

- (instancetype)initWithTitle:(NSString *)title msg:(NSString *)msg btnTitle:(NSString *)btnTitle handel:(handel)handel {
    
    self = [super init];
    
    if (self) {
        _alertTitle = title;
        _alertMsg = msg;
        _alertBtn = btnTitle;
        _handel = handel;
    }
    
    return self;
}

- (void)viewDidLoad {
    [super viewDidLoad];
    
    self.view.backgroundColor = [UIColor colorWithWhite:0 alpha:0.3];
    self.linView.backgroundColor = [UIColor groupTableViewBackgroundColor];
    self.titleLabel.text = self.alertTitle;
    self.msgLabel.text = self.alertMsg;
    [self.titleBtn setTitle:self.alertBtn forState:UIControlStateNormal];
    [self.titleBtn setTitleColor:kThemeColor forState:UIControlStateNormal];
}

- (IBAction)btnClick:(UIButton *)sender {
    
    if (self.handel) {
        self.handel(@"ok");
    }
}

- (void)showWithVC:(UIViewController *)vc {
    
    self.modalPresentationStyle = UIModalPresentationOverCurrentContext|UIModalPresentationFullScreen;
    [vc presentViewController:self animated:YES completion:nil];
}

@end
